package net.sf.ghost4j.extensions;

import java.io.Serializable;

import net.sf.ghost4j.Ghostscript;
import net.sf.ghost4j.GhostscriptException;

public class GhostscriptExtended implements Serializable {

	private Ghostscript gs;
	private Options options;

	public GhostscriptExtended() {
		this.gs = Ghostscript.getInstance();
		this.options = new Options();
	}

	public void execute() {
		try {
			gs.initialize(options.toGsOptions());
			gs.exit();
		} catch (GhostscriptException e) {
			System.out.println("ERROR: " + e.getMessage());
		}
	}

	public Options addOptions(String option) {
		this.options.addOption(option);
		return this.options;
	}

}
